const prefix = '/api';
const suffix = '.do';

const urlMap = {
	'dev': {
		'登录': '/sign',
		'退出登录': '/signout',
		'首页': '/main',
		'注册用户时发送验证码': '/sendCodeForSignup',
		'发送验证码': '/own/sendVerifyCode2',
		'发送验证码(未登录)': '/sendVerifyCode1',
		'注册': '/signup',
		'刷新令牌': '/refreshToken',
		'热门游戏区': '/productHotPlaceGameList',
		'游戏列表': '/gameList',
		'获取游戏子类列表': '/gameGenreList',
		'漫画列表': '/cartoonList',
		'漫画详情': '/cartoonDetail',
		'漫画章节列表': '/cartoonChapterList',
		'漫画章节详情': '/cartoonChapterDetail',
		'最近在玩': '/own/latestPlayedRecordByMainList',
		'首页产品推荐列表(首页轮播图)': '/productBannerList',
		'开始游戏': '/own/startGame',
		'游戏详情': '/gameDetail',
		'用户资金流记录列表': '/own/tradeRecordList',
		'获取余额': '/own/userBalance',
		'获取相关提供商信息以及余额': '/own/gameProviderDetail',
		'用户充值': '/own/createUserRechargeRecord',
		'支付方式列表': '/paymentWayList',
		'支付订单': '/own/payOrder',
		'用户详情': '/userInfo',
		'用户各游戏内钱包余额列表': '/own/userGameBalanceList',
		'账号金额变更[上游平台]': '/own/changeBalance',
		'获取余额和提现费率': '/userBalance',
		'用户请求提币': '/requestWithdrawing',
		'修改登录密码': '/updateLoginPw',
		'修改登入密码(未登入)': '/rePw1',
		'修改支付密码': '/own/reTradePw',
		'忘记密码': '/updateLoginPwNotLogin',
		'是否设置用户交易密码': '/isTradePw',
		'用户交易记录列表': '/userFundRecordListByUser',
		'判断是否为平台内或外': '/checkIfInnerAddress',
		'游戏提供商列表': '/gameProviderList',
		'搜索热词': '/own/keywordList',
		'授权码登录': '/authorizeCode',
		'区块链地址列表': '/own/userWalletAddressList',
	}
};

export const urlService = (type: string, key: string) => {
	const url = urlMap[type][key];
	if (url) {
		return prefix + urlMap[type][key] + suffix;
	} else {
		throw Error(`fail to find url: ${key}`);
	}
};

